package com.ikas.autumn.iec104.common.enums;

/**
 * 配置状态
 * @author HXH
 */
public enum ConfigStateEnum implements BaseEnum<ConfigStateEnum, Integer> {
    /**
     * 未配置
     */
    UNCONIFG(1, "未配置"),

    /**
     * 未开通
     */
    OPENING(2, "开通中"),

    /**
     * 已开通
     */
    OPENED(3, "已开通"),

    /**
     * 已上线
     */
    ONLINE(4, "已上线");

    private int value;
    private String displayName;

    /**
     * 获取枚举值
     * @return
     */
    @Override
    public Integer getValue() {
        return this.value;
    }

    @Override
    public String getDisplayName() {
        return this.displayName;
    }

    /**
     * 构造函数
     * @param value
     */
    ConfigStateEnum(int value, String displayName) {
        this.value = value;
        this.displayName = displayName;
    }

    /**
     * 整形转换为枚举
     * @param value 整形值
     * @return 枚举值
     */
    public static ConfigStateEnum parse(int value) {
        ConfigStateEnum rtn;
        switch (value) {
            case 2:
                rtn = OPENING;
                break;
            case 3:
                rtn = OPENED;
                break;
            case 4:
                rtn = ONLINE;
                break;
            default:
                rtn = UNCONIFG;
        }
        return rtn;
    }
}
